using System;
using System.Collections.Generic;
using System.Text;
using SubSonic;

namespace CommerceForUmbraco.xsltExtensions
{
    public class productmeta
    {
        public static string MetaTitle(string ProductGUID)
        {
            Guid _productGUID = new Guid(ProductGUID);

            // returns an ActiveRecord class which wraps the ProductMeta table
            CommerceForUmbraco.xsltExtensions.ProductMetum title = new CommerceForUmbraco.xsltExtensions.ProductMetum("productGUID", _productGUID);

            if (title.HtmlTitle.Length != 0)
                return title.HtmlTitle;
            else
                return "the default title";
        }

        public static string MetaDescription(string ProductGUID)
        {
            Guid _productGUID = new Guid(ProductGUID);


            CommerceForUmbraco.xsltExtensions.ProductMetum description = new CommerceForUmbraco.xsltExtensions.ProductMetum("productGUID", _productGUID);

            if (description.HtmlDescription.Length != 0)
                return description.HtmlDescription;
            else
                return "";
            
        }

        public static string MetaKeywords(string ProductGUID)
        {
            Guid _productGUID = new Guid(ProductGUID);

            CommerceForUmbraco.xsltExtensions.ProductMetum keywords = new CommerceForUmbraco.xsltExtensions.ProductMetum("productGUID", _productGUID);

            if (keywords.HtmlKeywords.Length != 0)
                return keywords.HtmlKeywords;
            else
                return "";

        }
    }
}